package com.ticket.sass.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ticket.sass.common.entity.tenant.PriceSchemeMemberPriceEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ywb
 * @since 2024-03-20
 */
public interface PriceSchemeMemberPriceMapper extends BaseMapper<PriceSchemeMemberPriceEntity> {
    @Select("""
        SELECT
            member_price.*, member_card_level."name" AS "member_level_name"
        FROM
            price_scheme_member_prices member_price
        INNER JOIN
            member_card_levels member_card_level
        ON
            member_price.member_level_id = member_card_level.id
        WHERE
            member_price.price_scheme_id IN (${priceSchemeIdsString})
        AND
            member_price.deleted_at IS NULL
        AND
            member_card_level.deleted_at IS NULL
    """)
    List<PriceSchemeMemberPriceEntity> listByPriceSchemeIds(@Param("priceSchemeIdsString") String priceSchemeIdsString);

}
